package com.normalClasses.eye;

public class Time {
	public  String time(long ATime,long BTime)
	{
		long TimeGap=ATime-BTime;
		long Res=0,YEAR=1536000,WEEK=604800,DAY=86400,HOUR=3600,MIN=60,SEC=1;
		long year= TimeGap/YEAR;
		Res=  TimeGap-year*YEAR;
		long week=     Res/WEEK;
		Res=      Res-week*WEEK;
		long day =     Res/DAY;
		Res=       Res-day*DAY;
		long hour=     Res/HOUR;
		Res=      Res-hour*HOUR;
		long min =     Res/MIN;
		Res=       Res-min*MIN;
		long sec =     Res/SEC;
		StringBuffer Ans=new StringBuffer();
		StringBuffer Year=new StringBuffer();
		StringBuffer Week=new StringBuffer();
		StringBuffer Day=new StringBuffer();
		StringBuffer Hour=new StringBuffer();
		StringBuffer Min=new StringBuffer();
		StringBuffer Sec=new StringBuffer();
		Year.append("年");
		Week.append("周");
		Day.append("日");
		Hour.append("小时");
		Min.append("分钟");
		Sec.append("秒");
		Ans.insert(0,check(Math.abs(sec),Sec));
		Ans.insert(0,check(Math.abs(min),Min));
		Ans.insert(0,check(Math.abs(hour),Hour));
		Ans.insert(0,check(Math.abs(day),Day));
		Ans.insert(0,check(Math.abs(week),Week));
		Ans.insert(0,check(Math.abs(year),Year));
		Ans.insert(0, "时间间隔为：");
		String ANS=Ans.toString();
		return ANS;
	}
	private static String check(long num,StringBuffer string) 
	{
		if(num!=0)
		{
			string.insert(0, num);
			return string.toString();
		}
		else
		{
			return "";
		}
	}
	public Time() {
	}
}
